package com.guoyu.gserv.dao.hibernate;

import java.util.List;

import org.hibernate.Criteria;
import org.hibernate.Session;
import org.hibernate.SessionFactory;

import com.guoyu.gserv.dao.NewTypeDao;
import com.guoyu.gserv.entity.NewType;

public class NewTypeImpi implements NewTypeDao {
	private SessionFactory sessionFactory;
	
	public SessionFactory getSessionFactory() {
		return sessionFactory;
	}

	public void setSessionFactory(SessionFactory sessionFactory) {
		this.sessionFactory = sessionFactory;
	}
	public Session getSession()
	{
		return getSessionFactory().getCurrentSession();
	}
	public void addNewType(NewType newType) {
		// TODO Auto-generated method stub
		getSession().save(newType);	
	}

	public void delNewType(NewType newType) {
		// TODO Auto-generated method stub
		getSession().delete(newType);
	}

	public List<NewType> selectNewType() {
		// TODO Auto-generated method stub
		Criteria c = getSession().createCriteria(NewType.class);
		List<NewType> list =c.list();
		return list;
	}

	public NewType selectNewTypeById(int newTypeId) {
		// TODO Auto-generated method stub
		return null;
	}

	public void upNewType(NewType newType) {
		// TODO Auto-generated method stub
		getSession().update(newType);
	}

	

}
